#include "math_3d.h"
#define GLEW_STATIC 1
#include <GL/glew.h>
#include <glut.h>
#include "glwindow.h"
#include "shader.hpp"
#include "config.h"



static GLuint vbo1;

static GLfloat positions[] = {
	0.0f, -1.0f,-0.9f,
	1.0f, 1.0f,0.9f,
	-1.0f, 1.0f,0.9f,
};


static void OnInitScene(void)
{
	glGenBuffers(1,&vbo1);
	glBindBuffer(GL_ARRAY_BUFFER,vbo1);
    glBufferData(GL_ARRAY_BUFFER,sizeof(positions),positions,GL_STATIC_DRAW);
	glEnableVertexAttribArray(0);
	glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,0,0);
 
}

static void OnReshapeWindow(int width,int height)
{

}

static void OnUpdateScene(float delta_time)
{
	glClear(GL_COLOR_BUFFER_BIT);
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

    glDrawArrays(GL_TRIANGLES,0,3);
    glutSwapBuffers();

}

static void OnRenderScene(void)
{
	
}
void BasicDrawing(int argc, char **argv)
{
	printf("Running BasicDrawing\n");
	GLWindowCreate(1024,1024);

	SetInitSceneCallBack(OnInitScene);
	SetReshapeWindowCallBack(OnReshapeWindow);
	SetUpdateSceneCallBack(OnUpdateScene);
	SetRenderSceneCallBack(OnRenderScene);

	GLWindowStart();
}


